package com.example.kotlindemo.函数

import java.io.Closeable
import java.io.File
import java.io.FileOutputStream

inline fun inlined(block:()->Unit){
    block()
}

fun main() {
    inlined {
        print("")
    }
    FileOutputStream(File("")).use {
        it.write("sdss".toByteArray())
    }
}

inline fun<T:Closeable?,R> T.use(block: (T) -> R):R{
    var closed = false
    try {
        return block(this)
    }catch (e:Exception){

    }finally {
        if(!closed){
            this?.close()
        }
    }

    return TODO("Provide the return value")
}

